package com.kang.controller;

import com.kang.service.CatalogService;
import com.kang.service.ItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author 吃三明治派对中的康康
 * @Date 2022/4/28 16:26
 * @Version 1.0
 */
@Controller
public class GoodsListController {

    @Autowired
    ItemsService itemsService;
    @Autowired
    CatalogService catalogService;

    @RequestMapping("/goodsList/{catalog}/{start}")
    public String goodsList(Model model, @PathVariable String catalog, @PathVariable int start){

        model.addAttribute("goodsListPage",itemsService.selectGoodsByPage(catalog, start));
        model.addAttribute("catalogs",catalogService.allCatalog());
        model.addAttribute("catalog",catalog);

        return "goodsList";
    }


}
